<?php

class Marketing_m extends CI_Model {
   
	function save_newletters($data){
		$this->db->where('email', $data['email']);
		$this->db->select('*');
		$obj = $this->db->get('newsletters')->row();
		if($obj && $obj->id){
			$this->db->where('id', $obj->id);
			return $this->db->update('newsletters', array('active' => 1));
		}else{
			$this->db->insert('newsletters', $data);
			return $this->db->insert_id();
		}
	}
	
	// function 
}
